<?php
echo $header;
echo $sidebar
?>	
<style>
	.row-fluid .span5{ width: 9.171%;}
	
</style>	
<div class="span10 content">
    <?php echo $hugemenu ?>

    <?php if ($this->session->flashdata('message')) { ?>
        <div class="alert alert-success">
            <?php echo $this->session->flashdata('message') ?>
        </div>
    <?php } ?>
    <table id="table_report" class="table table-striped table-bordered table-hover">
			<thead>
				
				<tr>
					<th>Status</th>
					<th>Date Created</th>
					<th style="width: 35%;">News</th>
					<th style="width: 20%;">Web Address</th>
					<th>Author</th>
					<th>Options</th>
				</tr>
			</thead>
									
			<tbody>
				<?php
				//print_r($news);
				if (!empty($news)) { ?>
				<?php
				foreach ($news as $key => $post) { ?>
				
				<tr>
					<td><?php
					if ($post['expiry_date']) {
									$diff = $post['expiry_date'] - time();
									if ($diff > 1) {
										echo "Active";
									} else {
										echo "Expired";
									}
									
					}else{ echo '---'; }
									?></td>
					<td><?php echo $post['date_created']?></td>
					
					<td><?php echo $post['message']?></td>
					<td><a href='<?php echo $post['link']?>' target="_blank"><?php echo $post['link']?></a></td>
					<td><?php echo $post['username']?></td>
					<td align="right">
						<div class='btn-group'>
							<a href='<?php echo site_url()?>news/view/edit_news/<?php echo $post['news_id']?>'>
							<button class='btn btn-mini btn-inverse'><i class='icon-edit'></i> Edit</button>
							</a>
							<a href='<?php echo site_url()?>news/delete_news/<?php echo $post['news_id']?>' onclick="return confirmdelete();">
							<button class='btn btn-mini btn-purple'><i class='icon-trash'></i> Delete</button>
							</a>
						</div>
					</td>
				</tr>
				<?php
				}
				?>
				<?php }else{?>
                <tr>
                	<td colspan="6">No data available in table</td>
                </tr>
				<?php }?>
				
			</tbody>
		</table><br />

		<a href='<?php echo site_url()?>news/view/add_news'>
		<button class="btn btn-success span5"><i class='icon-pushpin'></i>Add News</button>
		</a>

</div><!--/content-->

<?php echo $footer ?>